//@author A0096759E

package logic;

import storage.Storage;
import applogger.AppLogger;

public class ScheduleSorter {
	
	private static final String SORT_BY_ALPHABET = "-sa";
	private static final String SORT_BY_TIME = "-sc";
	private static final String SORT_BY_TYPE = "-st";
	Storage eventsList;

	/**
	 * Constructor for ScheduleSorter, takes in the current LifeShelf storage
	 * @param eventsList
	 */
	public ScheduleSorter(Storage eventsList) {
		this.eventsList = eventsList;
	}

	/**
	 * Reads what kind of sort is input, and sorts the storage accordingly
	 * @param userCommandDetails
	 * @return success message if done, else error message
	 */
	public String sortEvents(String userCommandDetails) {
		switch (userCommandDetails) {
			case SORT_BY_ALPHABET:
				AppLogger.log("Sorting By Alphabet");
				return eventsList.sortByAlphabet();
			case SORT_BY_TIME:
				AppLogger.log("Sorting By Time");
				return eventsList.sortByTime();
			case SORT_BY_TYPE:
				AppLogger.log("Sorting By Type");
				return eventsList.sortByType();
			default:
				AppLogger.log("Sorting By Time");
				return eventsList.sortByTime();
		}
	}

}
